package com.train.myjavaee.service.impl;

import com.train.myjavaee.mapper.UserMapper;
import com.train.myjavaee.pojo.po.User;
import com.train.myjavaee.service.UserService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
//import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * @Desc:用户登录
 * @author abubu
 * @date 2025/05/13
 */
@Service
@RequiredArgsConstructor
//@CrossOrigin(maxAge = 3600)
public class UserServiceImpl implements UserService {


    private final UserMapper mapper;
    /**
     * @param phone 手机号
     * @param password 密码
     * @Desc:用户登录
     * @return {@link String }
     */
    @Override
    public String login(String phone, String password) {

        User user = mapper.selectByPhone(phone);

        if (user == null) {
            return "not found";
        }
        if (user.getPassword().equals(password)) {
            return "成功！！QAQ";
        }

        return "fail";
    }
}
